package cn.itcast.mapper;

import cn.itcast.feign.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    //根据id查询客户信息
    @Select("select * from db08_homework.user where user_id=#{userId}")
    User getByUserId(Long userId);


    //删除客户信息
    @Delete("delete from db08_homework.user where user_id = #{userId}")
    void deleteById();

    //新增客户
    @Insert("insert into db08_homework.user(name,cid,rid,consumption,sex) values(#{name},#{cid},#{rid},#{consumption},#{sex})")
    void insert(User user);

    //修改用户
    @Update("update db08_homework.user set user_id=#{userId},name=#{name},cid=#{cid},rid=#{rid},consumption=#{consumption},sex=#{sex}")
    void update(User user);


    //分页查询客户信息

    List<User> list(String name, String sex);
}
